<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class Login extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'username'  =>  'require|mobile',
        'password' =>  'min:8|max:16|require|alphaNum',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'username.require' => '用户名必填',
        'username.mobile' => '用户名必须是手机号',
        'password.require' => '密码必填',
        'password.min' => '密码必须大于等于8位',
        'password.max' => '密码必须小于等于16位',
        'password.alphaNum' => '密码必须为字母和数字'
    ];
}
